<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>小易出行</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
          <script src="/Public/Js/jquery.min.js"></script>
    <link rel="stylesheet" href="/Public/Css/jtyc.css?v1" type="text/css" />
              <style>
        body{
            background-color: #F4F4F4;
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            margin: 0;
        }

        #map{
        display: none;    
            
        } 
        #title{
          margin-top: 80px;
         text-align: center;   
             
        }
        #title span{
            
          color:#666666;
          font-size: 24px;
            
        } 
    </style>
  

    </head>
  
        <div id="input">
<div class="main clearfix">
  <div class="module clearfix hide" id="waitNewOrder">
    <div class="info-welcome">您好，欢迎来到小易出行！</div>
  <div class="info-top">微信支付立减<span id="cars_around">5</span>元 </div>
    <form id="tab">
    <div class="form">
      <div class="form-bar icon-from" id="bar_from">
      	<span class="label"></span>
        <span class="field">
        	<input id="start" name="start" onclick="openwin('start')" type="text" value="正在获取您的位置" placeholder="您在哪里" readonly="">
        </span> 
      </div>
     
      <div class="form-bar icon-to no-border" id="bar_to">
      	<span class="label"></span>
      	<span class="field">
        	<input id="end" name="end" type="text" onclick="openwin('end')" placeholder="到哪里去" readonly="">
        </span>
      </div>
    </div>
    <div class="fare-form">
      <div class="form-bar" id="bar_fare" style="padding-bottom:2px; padding-top:1px;display:none">
      	<span class="field" id="add-minus"></span>
      </div>
    </div>
    <div class="form none">
      <button type="button" class="btn blue-large" id="createOrder" onclick="add()">预约司机</button>
    </div>
    </form>
<br><br><br>
        <div class="kefu">客服电话：<a href="tel:0372-6659666">0372-6659666</a>&nbsp;<a href="tel:0372-6659888">0372-6659888</a></div>
  
  </div>
</div>
        </div>
  <iframe id="geoPage" width=0 height=0 frameborder=0  style="display:none;" scrolling="no"
    src="http://apis.map.qq.com/tools/geolocation?key=JUUBZ-JJ732-AVHUW-CUNTK-NI7AT-L2BEW&referer=myapp">
</iframe>  
<div id="map">
  <iframe id="mapPage"  frameborder=0 src="">
</iframe>
    <input type="hidden" id="dy" value="<?php echo ($dy); ?>">
    
</div>   
  </body>
       <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> 
        <script>
          wx.config({
    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
    appId: "<?php echo ($data['appid']); ?>", // 必填，公众号的唯一标识
    timestamp:"<?php echo ($jsapi['timestamp']); ?>" , // 必填，生成签名的时间戳
    nonceStr: "<?php echo ($jsapi['noncestr']); ?>", // 必填，生成签名的随机串
    signature: "<?php echo ($data['signature']); ?>",// 必填，签名，见附录1
    jsApiList: ['checkJsApi',
            'openLocation',
            'getLocation',
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'getLocation',
            'openLocation'
        ] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
}); 

wx.ready(function(){ 
 
              window.addEventListener('message', function(event) {
                  var loc = event.data;
				  
				  // alert(loc.lat)
                  if(loc  && loc.module == 'geolocation') {

         $.ajax({
                type: "POST",
                url: "/index.php?s=/index/getaddress/fs/start",
           
                cache: false,
              //dataType:json,
                data: {
                             zb:loc.lat+','+loc.lng
                },
         
                    success: function(data) {
                 $("#mapPage").attr("src","http://apis.map.qq.com/tools/locpicker?search=1&type=1&key=JUUBZ-JJ732-AVHUW-CUNTK-NI7AT-L2BEW&coord="+loc.lat+','+loc.lng+"&referer=myapp")
     $('#start').val(data);
	

        }
        });   
        }
if (loc && loc.module == 'locationPicker') {
hidden();

  $.ajax({
                type: "POST",
                url: "/index.php?s=/index/getaddress/fs/"+ipid,
           
                cache: false,
              //dataType:json,
                data: {
                           zb:loc.latlng.lat+','+loc.latlng.lng
                },
         
                    success: function(data) {
                 
     $('#'+ipid).val(loc.poiname);

        }
        }); }
    
    }, false); 
});
  
        // 接收位置信息，用户选择确认位置点后选点组件会触发该事件，回传用户的位置信息
                                        

     

        function openwin(fss){
            window.ipid=fss;
     $('#map').show();
    
     $("#mapPage").css({"height":"600px","width":"100%"});
     $('#input').hide();}
 function hidden(){
   $('#map').hide();
     $('#input').show();  
     
     
 }
function add(){
   var dy=$('#dy').val();
    var start=$('#start').val();
    var end=$('#end').val();
    
    if(start ==='' || start==='正在获取您的位置'){
        
     alert('出发地不能为空');   
     return false;
    }
    else if(end === ''){
     alert('目的地不能为空');
     return false;
        
    }else{
   $.ajax({
      
                type: "POST",
                url: "/index.php?s=/index/addxl",
           
                cache: false,
              //dataType:json,
                 data: $('#tab').serialize(),
         
                    success: function(data) {
                 
if(dy === '1'){
      window.location.href="/index.php?s=/index/xl2/id/1.html";
    
}else{
       window.location.href="/index.php?s=/index/xl/id/1.html";
   }  
    

        }
        });     
    
    
}}
            </script>
           
</html>